<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'replyList.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <style>
  		*{
  			margin:0px;
  			padding:0px;
  		}
  		table{
  			width:500px;
  			text-align:center;
  			margin:200px auto 0px;
  		}
  		tr{
  			height:40px;
  		}
  		tr:nth-of-type(even){
  			background-color:rgba(0,0,0,0.1);
  		}
  </style>
  
  <body>
    
		<c:set var="ctx" value="${pageContext.request.contextPath }" />
		<table border="1px" cellspacing="2px" cellpadding="0px">
			<tr>
				<td colspan="3"><h2>回复信息列表</h2></td>
			</tr>
			<tr>
				<td colspan="3">
					<a href="${ctx }/invitation/addReplyByIdInfo?id=${id}">添加回复</a> || <a href="javascript:;" class="back">返回帖子列表</a>
				</td>
			</tr>
			<tr>
				<td>回复内容</td>
				<td>回复昵称</td>
				<td>发布时间</td>
			</tr>
			<c:choose>
	  			<c:when test="${replyList!=null and replyList.size()>0}">
					<c:forEach var="reply" items="${replyList}">
						<tr>
							<td>${reply.content }</td>
							<td>${reply.author }</td>
							<td><fmt:formatDate value="${reply.createDate }" pattern="yyyy-MM-dd" /></td>
						</tr>
					</c:forEach>
				</c:when>
  				<c:otherwise>
  					<tr>
  						<td colspan="3">没有查询到数据！</td>
  					</tr>
  				</c:otherwise>
  			</c:choose>
			<tr>
				<td colspan="3">
					<a href="${ctx }/invitation/getReplyById?pageIndex=1&id=${id}">首页</a>
					<a href="${ctx }/invitation/getReplyById?pageIndex=${page.pageIndex-1}&id=${id}">上一页</a>
					<a href="${ctx }/invitation/getReplyById?pageIndex=${page.pageIndex+1}&id=${id}">下一页</a>
					<a href="${ctx }/invitation/getReplyById?pageIndex=${page.totalPage}&id=${id}">末页</a>
					<span>第${page.pageIndex }/${page.totalPage }页</span>
				</td>
			</tr>
		</table>
	<script src="${ctx }/statics/js/jquery-1.12.4.js"></script>
	<script>
		$(function(){
			$(".back").click(function(){
				location.href="${ctx }/invitation/invitationList?pageIndex=1";
			});
		});
	</script>
  </body>
</html>
